%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/v4/streamLoads"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 7, 10, 11, 21, 22, 35, 12<br />2: PgSelect[9]<br />3: Connection[13]<br />4: ConnectionItems[15]"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 13, 15, 12, 21, 22, 7<br /><br />ROOT Connectionᐸ9ᐳ[13]"):::bucket
    Bucket3("Bucket 3 (listItem)<br />Deps: 12, 21, 22, 7<br /><br />ROOT __Item{3}ᐸ15ᐳ[18]"):::bucket
    Bucket4("Bucket 4 (nullableBoundary)<br />Deps: 19, 12, 21, 22, 7<br /><br />ROOT PgSelectSingle{3}ᐸpersonᐳ[19]<br />1: <br />ᐳ: PgClassExpression[20]<br />2: PgSelect[23]<br />3: PgSelectRows[29]"):::bucket
    Bucket5("Bucket 5 (listItem)<br /><br />ROOT __Item{5}ᐸ29ᐳ[31]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket3
    Bucket3 --> Bucket4
    Bucket4 --> Bucket5

    %% plan dependencies
    PgSelect9[["PgSelect[9∈0] ➊<br />ᐸpersonᐳ<br />More deps:<br />- Object[12]<br />- Constantᐸ1ᐳ[35]"]]:::plan
    Object12{{"Object[12∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 2"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access11{{"Access[11∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access10 & Access11 --> Object12
    Connection13[["Connection[13∈0] ➊<br />ᐸ9ᐳ<br />More deps:<br />- Constantᐸ1ᐳ[35]"]]:::plan
    PgSelect9 --> Connection13
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access10
    __Value2 --> Access11
    ConnectionItems15[["ConnectionItems[15∈0] ➊"]]:::plan
    Connection13 --> ConnectionItems15
    __Item18[/"__Item[18∈3]<br />ᐸ15ᐳ"\]:::itemplan
    ConnectionItems15 ==> __Item18
    PgSelectSingle19{{"PgSelectSingle[19∈3]<br />ᐸpersonᐳ"}}:::plan
    __Item18 --> PgSelectSingle19
    PgSelect23[["PgSelect[23∈4@s]<br />ᐸpostᐳ<br />More deps:<br />- Object[12]"]]:::plan
    PgClassExpression20{{"PgClassExpression[20∈4]<br />ᐸ__person__.”id”ᐳ"}}:::plan
    PgClassExpression20 --> PgSelect23
    PgSelectSingle19 --> PgClassExpression20
    PgSelectRows29[["PgSelectRows[29∈4@s]"]]:::plan
    PgSelect23 --> PgSelectRows29
    __Item31[/"__Item[31∈5]<br />ᐸ29ᐳ"\]:::itemplan
    PgSelectRows29 ==> __Item31
    PgSelectSingle32{{"PgSelectSingle[32∈5]<br />ᐸpostᐳ"}}:::plan
    __Item31 --> PgSelectSingle32
    PgClassExpression33{{"PgClassExpression[33∈5]<br />ᐸ__post__.”id”ᐳ"}}:::plan
    PgSelectSingle32 --> PgClassExpression33
    PgClassExpression34{{"PgClassExpression[34∈5]<br />ᐸ__post__.”headline”ᐳ"}}:::plan
    PgClassExpression33 o--o PgClassExpression34

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect9,Access10,Access11,Object12,Connection13,ConnectionItems15 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1 bucket1
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item18,PgSelectSingle19 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgClassExpression20,PgSelect23,PgSelectRows29 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5,__Item31,PgSelectSingle32,PgClassExpression33,PgClassExpression34 bucket5

